const router = require('./router');

router.post('/login', (req, res) => {
    const params = req.body;

    console.log('login params', params)

    const {
        uname,
        pwd
    } = params;
    const flag =
        (uname === '张三' && pwd === '123') ||
        (uname === '李四' && pwd === '456') ||
        (uname === '王五' && pwd === '789');
    console.log('flag', flag)
    if (flag) {
        res.json({
            code: "0",
            data: {
                txt: '登录请求成功'
            },
            msg: '成功',
            success: true
        })
    } else {
        res.json({
            code: "-1",
            data: {
                txt: '用户名或密码不正确'
            },
            msg: '错误',
            success: false
        })
    }

})

module.exports = router;